/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.restaurant.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Dexter
 */
@Entity
@Table(name = "TablesInReservations")
@NamedQueries({
    @NamedQuery(name = "TablesInReservations.findAll", query = "SELECT t FROM TablesInReservations t"),
    @NamedQuery(name = "TablesInReservations.findByTableInReservationId", query = "SELECT t FROM TablesInReservations t WHERE t.tableInReservationId = :tableInReservationId")})
public class TablesInReservations implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "TableInReservationId")
    private Long tableInReservationId;
    @JoinColumn(name = "TableId", referencedColumnName = "TableId")
    @ManyToOne(fetch = FetchType.LAZY)
    private Tables tableId;
    @JoinColumn(name = "ReservationId", referencedColumnName = "ReservationId")
    @ManyToOne(fetch = FetchType.LAZY)
    private Reservations reservationId;
    
    public TablesInReservations() {
    }

    public TablesInReservations(Long tableInReservationId) {
        this.tableInReservationId = tableInReservationId;
    }

    public Long getTableInReservationId() {
        return tableInReservationId;
    }

    public void setTableInReservationId(Long tableInReservationId) {
        this.tableInReservationId = tableInReservationId;
    }

    public Tables getTableId() {
        return tableId;
    }

    public void setTableId(Tables tableId) {
        this.tableId = tableId;
    }

    public Reservations getReservationId() {
        return reservationId;
    }

    public void setReservationId(Reservations reservationId) {
        this.reservationId = reservationId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tableInReservationId != null ? tableInReservationId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TablesInReservations)) {
            return false;
        }
        TablesInReservations other = (TablesInReservations) object;
        if ((this.tableInReservationId == null && other.tableInReservationId != null) || (this.tableInReservationId != null && !this.tableInReservationId.equals(other.tableInReservationId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.restaurant.entities.TablesInReservations[ tableInReservationId=" + tableInReservationId + " ]";
    }
    
}
